#if !defined(_LAST_LOADED_FIRST_NAME_RESOLUTOR_H)
#define _LAST_LOADED_FIRST_NAME_RESOLUTOR_H

#include "INameResolutor.h"
#include "DescriptorsRepository.h"
#include "Utility.h"

#include <list>
#include <boost/regex.hpp>
#include <boost/foreach.hpp>

CREATE_ALIAS( LastLoadedFirstNameResolutor )

/**
 * A name resolutor implementation that use the Last Loaded First rule.
 */
class DECLARATION_DLL LastLoadedFirstNameResolutor : public INameResolutor
{
	/** List of loaded plugins */
	list<PluginSp> plugins;

	/** Use for regular expression. */
	smatch m;

	/** Reference to the descriptor repository */
	DescriptorsRepositorySp descriptorsRepository;

public:

	LastLoadedFirstNameResolutor();

	/**
	 * Get the fully qualified name of a type.
	 */
	virtual string ResolveTypeName(string type);

	/**
	 * Get the fully qualified name of a command.
	 */
	virtual string ResolveCommandName(string command);

	/**
	 * Add a reference to a new plugin or select a plugin.
	 */
	virtual void AddOrSelectPlugin(PluginSp plugin);
};

#endif  // _LAST_LOADED_FIRST_NAME_RESOLUTOR_H
